package com.qfedu.controller;

import com.qfedu.pojo.req.GoodsClassifyReq;
import com.qfedu.pojo.resp.BaseResp;
import com.qfedu.service.GoodsClassifyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName GoodsclassifyController
 * @Description TODO
 * @Author young
 * @Date 2022-09-27 14:19
 * @Version 1.0
 **/
@RestController
@RequestMapping("/goodsClassify")
@Api(tags = "商品分类管理")
public class GoodsClassifyController {
    @Autowired
    GoodsClassifyService goodsclassifyService;

    @ApiOperation(value = "查询所有一级分类")
    @GetMapping("/findAll")
    public BaseResp findAll(){
        return goodsclassifyService.findAll();
    }

    @ApiOperation(value = "新增或修改一级分类")
    @PostMapping("/saveOrUpdate")
    public BaseResp saveOrUpdate(@RequestBody GoodsClassifyReq goodsClassifyReq){
        return goodsclassifyService.saveOrUpdate(goodsClassifyReq);
    }

    @ApiOperation(value = "根据id删除一级分类")
    @PostMapping("/deleteById")
    public BaseResp deleteById(@RequestBody GoodsClassifyReq goodsClassifyReq){
        return goodsclassifyService.deleteById(goodsClassifyReq);
    }
}
